package com.frame.sulent.datasource.process;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

public class DataSourceProcessorProvider {
    private static final Logger logger = LoggerFactory.getLogger(DataSourceProcessorProvider.class);

    private DataSourceProcessorManager dataSourcePluginManager;

    private DataSourceProcessorProvider() {
        initDataSourceProcessorPlugin();
    }

    private static class DataSourceClientProviderHolder {
        private static final DataSourceProcessorProvider INSTANCE = new DataSourceProcessorProvider();
    }

    public static DataSourceProcessorProvider getInstance() {
        return DataSourceClientProviderHolder.INSTANCE;
    }

    public Map<String, DataSourceProcessor> getDataSourceProcessorMap() {
        return dataSourcePluginManager.getDataSourceProcessorMap();
    }

    private void initDataSourceProcessorPlugin() {
        dataSourcePluginManager = new DataSourceProcessorManager();
        dataSourcePluginManager.installProcessor();
    }
}
